#ifndef LIST_H
#define	LIST_H

#include	"base.h"

template<class element>
class List{
	private:
		uint32	_size;
		uint32	_dataLength;
		element*	_data;
	public:
		List(){
			this->_data = new element[10];
			this->_dataLength = 10;
			this->_size = 0;
		};
		~List(){
			delete this->_data;
		};
		void add(element el){
			if(this->_dataLength <= (this->_size+1)){
				uint32	nuLen = this->_dataLength * 2;
				element* nu = new element[nuLen];
				for(uint32 i=0;i<this->_dataLength;i++){
					nu[i] = this->_data[i];
				}		
				this->_data = nu;
				this->_dataLength = nuLen;
			}
			
			this->_data[this->_size] = el;
			this->_size++;
		};
		element	get(uint32 index){
			if(this->size <= index)
				throw "Array index out of bounds";
			return this->_data[index];
		};
		uint32	size(void){
			return this->_size;
		};
};

#endif